dialog: Show the action area when needed
authorMatthias Clasen <mclasen@redhat.com>
Fri, 17 Jan 2014 04:58:49 +0000 (23:58 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 17 Jan 2014 22:52:08 +0000 (17:52 -0500)
If we find that widgets are being added to the action area,
we should show it. Also warn in this situation.

gtk/gtkdialog.c

index 90eeabc1f97157f50a7ee00cab462b91646af15f..fa52c77b25aa51112a3c3095144ac5483f86c66f 100644 (file)
@@ -258,6 +258,19 @@ gtk_dialog_set_use_header_bar_from_setting (GtkDialog *dialog)
                 NULL);
 }
 
+static void
+add_cb (GtkContainer *container,
+        GtkWidget    *widget,
+        GtkDialog    *dialog)
+{
+  GtkDialogPrivate *priv = dialog->priv;
+
+  if (priv->use_header_bar)
+    g_warning ("Content added to the action area of a dialog using header bars");
+
+  gtk_widget_show (GTK_WIDGET (container));
+}
+
 static void
 apply_use_header_bar (GtkDialog *dialog)
 {
@@ -267,6 +280,8 @@ apply_use_header_bar (GtkDialog *dialog)
   gtk_widget_set_visible (priv->headerbar, priv->use_header_bar);
   if (!priv->use_header_bar)
     gtk_window_set_titlebar (GTK_WINDOW (dialog), NULL);
+  if (priv->use_header_bar)
+    g_signal_connect (priv->action_area, "add", G_CALLBACK (add_cb), dialog);
 }
 
 static void